package com.atguigu.day16.test05;

import java.util.Arrays;
import java.util.Comparator;

/**
 * @author fenge
 */
public class Test05 {
    //    Comparator
    public static void main(String[] args) {
        String[] str = new String[]{"sadasf", "abcdefg", "abc", "dgxcv"};
        sort(str);
        System.out.println(Arrays.toString(str));
        sort(str, new Comparable<String>() {
            @Override
            public int compareTo(String o) {
                return 0;
            }
        });
        Comparator c1 =new Comparator() {
            @Override
            public int compare(Object o1, Object o2) {
                return 0;
            }
        };
    }

    public static <T> void sort(T[] arr) {
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr.length - 1; j++) {
                if (((Comparable) arr[j]).compareTo(arr[j + 1]) > 0) {
                    T temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }
            }
        }
    }

    public static <T> void sort(T[] arr, Comparable<? super T> c) {

    }
}
